#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}

ll qmi(ll a, ll b)
{
    ll res = 1;
    while(b)
    {
        if(b & 1)res = res * a % mod;
        b >>= 1;
        a = a * a % mod;
    }
    return res;
}
struct custom_hash {
	static uint64_t splitmix64(uint64_t x) {
		x ^= x << 13;
		x ^= x >> 7;
		x ^= x << 17;
		return x; 
	}
	size_t operator () (uint64_t x) const {
		static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); // 时间戳
		return splitmix64(x + FIXED_RANDOM);
	}
};

void solve()
{
    int n;
    cin >> n;
    vector<vector<int>> pp(3, vector<int>(n + 1));
    for(int i = 0; i < 3; i++)
    {
        for(int j = 1; j <= n; j++) cin >> pp[i][j];
    }
    vector<pii> a(3), b(3), c(3);
    for(int i = 1; i <= n; i++)
    {
        if(pp[0][i] > a[0].first){
            a[2] = a[1];
            a[1] = a[0];
            a[0] = {pp[0][i], i};
        }
        else if(pp[0][i] > a[1].first){
            a[2] = a[1];
            a[1] = {pp[0][i], i};
        }
        else if(pp[0][i] > a[2].first) a[2] = {pp[0][i], i};
    }
    for(int i = 1; i <= n; i++)
    {
        if(pp[1][i] > b[0].first){
            b[2] = b[1];
            b[1] = b[0];
             b[0] = {pp[1][i], i};
        }
        else if(pp[1][i] > b[1].first){
            b[2] = b[1];
            b[1] = {pp[1][i], i};
        }
        else if(pp[1][i] > b[2].first) b[2] = {pp[1][i], i};
    }
    for(int i = 1; i <= n; i++)
    {
        if(pp[2][i] > c[0].first) {
            c[2] = c[1];
            c[1] = c[0];
            c[0] = {pp[2][i], i};
        }
        else if(pp[2][i] > c[1].first) {
            c[2] = c[1];
            c[1] = {pp[2][i], i};
        }
        else if(pp[2][i] > c[2].first) c[2] = {pp[2][i], i};
    }
    int ans = 0;
    for(int i = 0; i < 3; i++)
    {
        unordered_map<int, int> mp;
        mp[a[i].second]++;
        for(int j = 0; j < 3; j++)
        {
            if(mp[b[j].second]) continue;
            mp[b[j].second]++;
            for(int k = 0; k < 3; k++)
            {
                if(mp[c[k].second]) continue;
                ans = max(a[i].first + b[j].first + c[k].first, ans);
            }
            mp.erase(b[j].second);
        }
    }
    cout << ans << endl;
    
}

int main()
{
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}